import Cart from '@/views/cart'
import Category from '@/views/category'
import SubCategory from '@/views/category/SubCategory'
import Detail from '@/views/detail'
import Home from '@/views/home'
import List from '@/views/list'
import Login from '@/views/login'
import Mine from '@/views/mine'
import Register from '@/views/register'
import AddressList from '@/views/addresslist'
import Tabber from '@/components/tabber'
import HeaderSearch from '@/components/HeaderSearch'
import HeaderTitle from '@/components/HeaderTitle'

const routes = [
  {
    path: '/',
    redirect: '/Home',
    meta: {}
  },
  {
    path: '/home',
    name: 'home',
    components: {
      default: Home,
      footer: Tabber
    },
    meta: {
      isNav: true,
      title: '首页',
      icon: '&#xe613;'
    }
  },
  {
    path: '/category',
    name: 'category',
    components: {
      header: HeaderTitle,
      default: Category,
      footer: Tabber
    },
    children: [
      {
        path: 'sub/:id',
        components: {
          header: HeaderTitle,
          default: SubCategory,
          footer: Tabber
        },
        meta: {
          title: '二级分类'
        }
      }
    ],
    meta: {
      isNav: true,
      title: '分类',
      icon: '&#xe618;'
    }
  },
  {
    path: '/cart',
    name: 'cart',
    components: {
      header: HeaderTitle,
      default: Cart
    },
    meta: {
      isNav: true,
      title: '购物车',
      icon: '&#xe63d;'
    }
  },
  {
    path: '/detail/:id',
    name: 'detail',
    components: {
      header: HeaderTitle,
      default: Detail
    },
    meta: {}
  },
  {
    path: '/list',
    name: 'list',
    components: {
      header: HeaderTitle,
      default: List,
      footer: Tabber
    },
    meta: {}
  },
  {
    path: '/login',
    name: 'login',
    components: {
      header: HeaderTitle,
      default: Login
    },
    meta: {
      title: '用户登录'
    }
  },
  {
    path: '/mine',
    name: 'mine',
    components: {
      default: Mine,
      footer: Tabber
    },
    meta: {
      isNav: true,
      title: '我的',
      icon: '&#xe61c;'
    }
  },
  {
    path: '/register',
    name: 'register',
    components: {
      header: HeaderTitle,
      default: Register,
      footer: Tabber
    },
    meta: {
      title: '设置购物地址'
    }
  },
  {
    path: '/addresslist',
    name: 'addresslist',
    components: {
      header: HeaderTitle,
      default: AddressList,
      footer: Tabber
    },
    meta: {
      title: '新增购物地址'
    }
  }
]
export default routes
